<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Object</title>
</head>
<body>
	<script>
		window.onload = function(){
			console.log(new Object({'a' : function(){},'b' : 'slieer'}));
			objOne();
			objSec();
			console.info(objThree());

			console.info(math.factorial(5));

			//function 没有明确的返回值时，返回undefined
			console.info(math.fun());
		}
		function objOne(){
			var o = Object.create(null);
			//alert(o);
	
			o.a = "hello";
			o.func = function(){
				console.info('in func.');
			}
	
			o.func();
			console.info(o.a);
		}

		
		function objSec(){
			var o1 = {};
			var o2 = Object.create(Object.prototype);
			if(o1 == o2){
				console.info('o1 == o2.');
			}else{
				//true
				console.info('o1 != o2');
			}

			if(o1 === o2){
				console.info('o1 === o2');
			}else{
				console.info('o1 !=== o2')
			}
		}

		function objThree(){
			var o10 = Object.create(
				{}, 
				{ 
					p: { value: 42} 
				},
				{
					p1 : { value: 42, writable: true, enumerable: true, configurable: true }
				}
				/** ,
				p2 : function(){
					console.info('p2......');
				}*/
			)
			return o10; 
		}
		
		var math = { 
				 'factorial': function factorial(n) {
					    if (n <= 1)      return 1;    
					    return n * factorial(n - 1);  
			    },
			    'fun' : function(){
						console.info('func');
				}
	    };		
	</script>
</body>
</html>